package com.giggle.demo;

import com.giggle.mybatis.utils.GeneratorMybatisUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
import tk.mybatis.spring.annotation.MapperScan;

@SpringBootApplication
@MapperScan({"com.giggle.demo.mapper"})
@ComponentScan(basePackages = {"com.giggle.demo"})
//@NacosPropertySource(dataId = "giggle-demo.properties", groupId = "demo", autoRefreshed = true,properties = @NacosProperties(namespace = "7c22b50a-55f9-492c-81c3-e05199b9958b"))
@Slf4j
public class DemoApplication implements InitializingBean {

    @Value(value = "${nacos:error}")
    private String nacos;

    @Value(value = "${spring.datasource.mysqlDataSource.driver-class-name:error}")
    private String mysqlClassName;

    public static void main(String[] args) {
        SpringApplication.run(DemoApplication.class, args);
        GeneratorMybatisUtils.generator();
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        log.info("属性注入后，输入nacos：{}",nacos);
        log.info("属性注入后，输入mysqlClassName：{}",mysqlClassName);
    }
}
